from agno.agent import Agent, RunResponse
from agno.models.openai.like import OpenAILike
from os import getenv
from typing import Iterator
from agno.utils.pprint import pprint_run_response

agent = Agent(
    model=OpenAILike(
        id="qwen3-235b-a22b",
        api_key=getenv("BAILIAN_API_KEY"),
        base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
    ),
    stream=True,
    monitoring=True,
    markdown=True,
)

# Get the response in a variable
# run: RunResponse = agent.run("讲一个两句话的超级反转故事")
# print(run.content)

# 由于阿里的模型只能流式输出，需要加stream=true的参数
agent.print_response("讲一个机器人的故事，100字以内", stream=True)
